<template>
  <a-button type="primary" @click="login">登录</a-button>
</template>
<script lang="ts">
import { defineComponent } from "vue";
import { useState, useGetters, useActions } from "@hooks/store/index";
import { getUserInfo } from "@services/controller";
import { useRouter } from "vue-router";
export default defineComponent({
  name: "login",
  setup() {
    const storeActions = useActions(["setAsyncRoutes"]);
    const router = useRouter()

    const login = async () => {
      try {
        let response = await getUserInfo({})
        storeActions.setAsyncRoutes(response.data);
        router.push({
          path: "/stocklist"
        })
      } catch (error) {
        console.log(error);
      }
    };
    return {
      login,
    };
  },
});
</script>
<style lang="less" scoped>
</style>
